﻿namespace Serializator
{
    using Serializator.JSONObjects;
    using System;

    /// <summary>
    /// Class for Facroty method 
    /// </summary>
    public static class JSONObjectFactory
    {
        /// <summary>
        /// Facroty method for JSONObject
        /// </summary>
        /// <param name="mark">Mark to define JSON object</param>
        /// <returns>JSONObject</returns>
        public static JSONObject GetJSONObjectInstance(Type mark)
        {
            switch (mark.Name)
            {
                case "JSONClassObject":
                    {
                        return new JSONClassObject();
                    }
                case "JSONArrayObject":
                    {
                        return new JSONArrayObject();
                    }
                case "JSONValueObject":
                    {
                        return new JSONValueObject();
                    }
                default:
                    {
                        return null;
                    }
            }
        }

    }
}
